
<include file="Public:header" />
<include file="Public:leftside" />
<script type="text/javascript">
	var url='http://www.'+document.domain.split('.').slice(-2).join('.');
</script>
<div class="main-content">
	<div class="breadcrumbs breadcrumbs-fixed" id="breadcrumbs">
		<ul class="breadcrumb">
			<li> <i class="icon-home home-icon"></i>
				<a href="/">首页</a>
			</li>
			<li class="active">文章管理</li>
		</ul>
	</div>
	<section class="scrollable wrapper">
		<!-- 操作提示  start -->
		<!-- 操作提示  end -->

		<div class="row padder-v">
			<div class="col-sm-9">
				<a class="btn btn-sm btn-primary" href="{:U('Portal/addArticle')}"><i class="fa fa-plus"></i>&nbsp;添加文章</a>
			</div>
			
			
		</div>
		<section class="panel panel-default">
			<div class="table-responsive">
				<table class="table table-striped b-t b-light text-sm">
					<thead>
						<tr>
							
							<th>标题</th>
							<th class="center">分类</th>
							<th class="center">点击量</th>
							<th class="center">发布时间</th>
							<th class="center">状态</th>
							<th class="center">操作</th>
						</tr>
					</thead>
					<tbody id="list">
						<foreach name="article_list" item="v">
						<tr>
							<td title="{$v.post_title}">{$v.post_title}</td>
							<td class="center">{$v.name}</td>
							<td class="center">{$v.post_hits}</td>
							<td class="center">{$v.post_date}</td>
							<td class="center">已发布</td>
							<td class="center">
								<script type="text/javascript">
									$(function(){
										var href=url+'/article/index/id/{$v.id}';
										$('.yl_{$v.id}').attr('href',href);
									})
									
								</script>
								<a target="_blank" href="" class="yl_{$v.id}">预览</a>&nbsp;&nbsp;
								<a href="{:U('Portal/updateArticle',array('id'=>$v['id']))}">修改</a>&nbsp;&nbsp;
								<a style="cursor: pointer;" onclick="deleteArticle({$v.id})">删除</a>
							</td>
						</tr>
						</foreach>
					</tbody>
				</table>
			</div>
			<style type="text/css">
				.pagination{}
				.pagination a{display: block;float: left;border-bottom-left-radius: 3px;border-top-left-radius: 3px;padding: 5px 10px;font-size: 12px;font-weight: 500;border-radius: 2px;}
				.pagination span{display: block;float: left;border-bottom-left-radius: 3px;border-top-left-radius: 3px;background-color: #fafafa;border: 1px solid #dddddd;padding: 5px 10px;font-size: 12px;font-weight: 500;border-radius: 2px;}
			</style>
			<footer class="panel-footer">
				<div class="row" id="page">

					<div class="col-sm-2 text-center">
						<small class="text-muted inline m-tb-8">总计 <span id="total_count_num">{$count}</span>个记录</small>
					</div>
					<div class="col-sm-5 text-right text-center-xs">
						<ul class="pagination pagination-sm m-t-none m-b-none">
							{$page}
						</ul>
					</div>
					
				</div>
			</footer>

		</section>

	</section>
	<script>
        //删除分类
        function deleteArticle(class_id) {
            layer.confirm('是否确认删除？', {
                btn: ['确认','不了'] //按钮
            }, function(){
                $.ajax({
                    type: "post",
                    url: "{:U('Portal/del_page')}",
                    async: true,
                    data: {
                        "class_id": class_id
                    },
                    success: function(data) {
                        if(data["code"] == 0) {
                            layer.msg('删除失败')
                        }
                        if(data["code"] == 1) {
                            layer.msg('删除成功')
                            setTimeout("location.reload()",1000)
                        }

                    }
                })
            }, function(){

            });

        }
	</script>
</div>

<include file="Public:footer" />